package com.nwcl.ysx.service.impl;

import com.nwcl.common.request.PageRequest;
import com.nwcl.common.utils.BeanUtil;
import com.nwcl.ysx.bo.CuisineRoomBO;
import com.nwcl.ysx.dao.CuisineRoomDao;
import com.nwcl.ysx.entity.CuisineRoom;
import com.nwcl.ysx.service.CuisineRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @author liguiqin
 * @date 2023/5/29
 */
@Service
public class CuisineRoomServiceImpl implements CuisineRoomService {
    @Autowired
    private CuisineRoomDao cuisineRoomDao;
    @Override
    public CuisineRoomBO listCuisineByRoomId(Integer roomId, List<Integer> cuisineIds) {
        CuisineRoom cuisineRoom =cuisineRoomDao.listCuisineByRoomId(roomId,cuisineIds);
        if (cuisineRoom!=null){
            return BeanUtil.copy(cuisineRoom,CuisineRoomBO.class);
        }
        return null;
    }

    @Override
    public List<CuisineRoomBO> listCuisineByRoomIds(List<Integer> roomIds, List<Integer> cuisineIds) {
        List<CuisineRoom> cuisineRooms =cuisineRoomDao.listCuisineByRoomIds(roomIds,cuisineIds);
        if (cuisineRooms!=null){
            return BeanUtil.copyList(cuisineRooms,CuisineRoomBO.class);
        }
        return Collections.emptyList();
    }
}
